<template>
    <view>
        <userMine v-if="user_status === 1" :userStatus.sync="user_status" />

        <technicianMine
            v-if="user_status === 2"
            :userStatus.sync="user_status"
        />

        <tabbar :cur="5"></tabbar>
    </view>
</template>

<script>
import tabbar from "@/components/tabbar.vue";
import userMine from "@/subPages/components/mine/mine_user.vue";
import technicianMine from "@/subPages/components/mine/mine_technician.vue";
import { mapState, mapActions, mapMutations } from "vuex";
export default {
    components: {
        tabbar,
        userMine,
        technicianMine,
    },
    data() {
        return {
            user_status: this.$stoarge.getUserStatus(), //1:普通用户 2:技师
        };
    },
    computed: mapState({
        primaryColor: (state) => state.config.configInfo.primaryColor,
        subColor: (state) => state.config.configInfo.subColor,
        configInfo: (state) => state.config.configInfo,
        commonOptions: (state) => state.user.commonOptions,
        userInfo: (state) => state.user.userInfo,
        userPageType: (state) => state.user.userPageType,
        locationChange: (state) => state.user.locationChange,
        location: (state) => state.user.location,
        mineInfo: (state) => state.user.mineInfo,
        coachInfo: (state) => state.user.coachInfo,
    }),
    onShow() {
        if (this.user_status === 1) {
            uni.$emit("onUserShow");
        } else if (this.user_status === 2) {
            uni.$emit("onTechnicianShow");
        }
        this.getUserInfo();
    },
    onPullDownRefresh() {
        if (this.user_status === 1) {
            uni.$emit("onUserShow");
        } else if (this.user_status === 2) {
            uni.$emit("onTechnicianShow");
        }
    },
    methods: {
        ...mapActions([
            "getConfigInfo",
            "getUserInfo",
            "getMineInfo",
            "getCoachInfo",
            "updateCommonOptions",
        ]),
    },
};
</script>
